package com.cyzy.service;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Service;

@Service
public class EmailService {

    @Autowired
    private JavaMailSender mailSender;

    public void sendSimpleEmail(String to, String subject, String text) {
        SimpleMailMessage message = new SimpleMailMessage();
        message.setFrom("18050195959@163.com");  //发件人
        message.setTo(to);  //收件人邮箱地址
        message.setSubject(subject);  //邮件主题
        message.setText(text); //HTML 格式的邮件内容
        mailSender.send(message);
    }

}
